package com.ecoolex.discount.sales.ws;

import java.util.List;

import com.ecoolex.discount.sales.core.manager.*;
import com.ecoolex.discount.sales.core.service.QuanMaoService;
import com.ecoolex.discount.sales.core.service.YouWorldService;
import com.ecoolex.discount.sales.entity.*;
import com.ecoolex.discount.sales.enums.DiscountProductServiceType;
import com.ecoolex.discount.sales.pojo.*;
import org.apache.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;

import com.ecoolex.framework.common.exception.BizException;
import com.ecoolex.framework.common.pojo.Page;
import com.ecoolex.framework.common.pojo.Pagination;
import com.ecoolex.framework.common.pojo.Sorting;

@Service
public class DiscountProductServiceImpl implements DiscountProductService {

    @Autowired
    private DiscountClassifyManager discountClassifyManager;

    @Override
    public DiscountClassify addDiscountClassify(DiscountClassify record, String createUser) throws BizException {
        return discountClassifyManager.addDiscountClassify(record, createUser);
    }

    @Override
    public DiscountClassify editDiscountClassify(DiscountClassify record, String updateUser) throws BizException {
        return discountClassifyManager.editDiscountClassify(record, updateUser);
    }

    @Override
    public void deleteDiscountClassify(DiscountClassify record, String updateUser) throws BizException {
        discountClassifyManager.deleteDiscountClassify(record, updateUser);
    }

    @Override
    public void onlineDiscountClassify(DiscountClassify record, String updateUser) throws BizException {
        discountClassifyManager.onlineDiscountClassify(record, updateUser);
    }

    @Override
    public void offlineDiscountClassify(DiscountClassify record, String updateUser) throws BizException {
        discountClassifyManager.offlineDiscountClassify(record, updateUser);
    }

    @Override
    public DiscountClassify getDiscountClassify(Integer classifyId) {
        return discountClassifyManager.getDiscountClassify(classifyId);
    }

    @Override
    public Pagination<DiscountClassify> queryDiscountClassify(QueryDiscountClassifyDTO query, Sorting[] sorts, Page page) {
        return discountClassifyManager.queryDiscountClassify(query, sorts, page);
    }
    
    @Override
	public DiscountClassify getDiscountClassifyByBrandIdForH5(Integer brandId, Integer regionType) {
		return discountClassifyManager.getDiscountClassifyByBrandIdForH5(brandId, regionType);
	}

    @Autowired
    private DiscountBrandManager discountBrandManager;

    @Override
    public DiscountBrandWithBLOBs addDiscountBrand(DiscountBrandWithBLOBs record, List<AddDiscountBrandClassifyDTO> list, String createUser) throws BizException {
        return discountBrandManager.addDiscountBrand(record, list, createUser);
    }

    @Override
    public DiscountBrandWithBLOBs editDiscountBrand(DiscountBrandWithBLOBs record, List<AddDiscountBrandClassifyDTO> list, String updateUser) throws BizException {
        return discountBrandManager.editDiscountBrand(record, list, updateUser);
    }

    @Override
    public void deleteDiscountBrand(DiscountBrandWithBLOBs record, String updateUser) throws BizException {
        discountBrandManager.deleteDiscountBrand(record, updateUser);
    }

    @Override
    public DiscountBrandWithBLOBs getDiscountBrand(Integer brandId) {
        return discountBrandManager.getDiscountBrand(brandId);
    }

    @Override
    public DiscountBrandWithBLOBs getDiscountBrandForH5(Integer brandId) {
        return discountBrandManager.getDiscountBrandForH5(brandId);
    }

    @Override
    public Long countProductService(DiscountProductServiceType serviceType, String serviceDataId) {
        return discountProductManager.countService(serviceType, serviceDataId);
    }

    @Override
    public Pagination<DiscountBrandWithBLOBs> queryDiscountBrand(QueryDiscountBrandDTO query, Sorting[] sorts, Page page) {
        return discountBrandManager.queryDiscountBrand(query, sorts, page);
    }

    @Override
    public List<DiscountBrandWithBLOBs> listDiscountBrandForH5(QueryMarketingClassifyBrandDTO query, Integer size) {
        return discountBrandManager.listDiscountBrandForH5(query, size);
    }

    @Override
    public void onlineDiscountBrand(DiscountBrandWithBLOBs record, String updateUser) throws BizException {
        discountBrandManager.onlineDiscountBrand(record, updateUser);
    }

    @Override
    public void offlineDiscountBrand(DiscountBrandWithBLOBs record, String updateUser) throws BizException {
        discountBrandManager.offlineDiscountBrand(record, updateUser);
    }

    @Autowired
    private DiscountBrandClassifyManager discountBrandClassifyManager;

    @Override
    public List<DiscountBrandClassify> getByBrandId(Integer brandId) {
        return discountBrandClassifyManager.getByBrandId(brandId);
    }

    @Autowired
    private DiscountProductManager discountProductManager;

    @Override
    public DiscountProductWithBLOBs getProductById(Integer productId) {
        return discountProductManager.getById(productId);
    }

    @Override
    public Pagination<DiscountProductWithBLOBs> queryProduct(QueryDiscountProductDTO query, Sorting[] sorts, Page page) {
        return discountProductManager.query(query, sorts, page);
    }

    @Override
    public DiscountProductWithBLOBs getOnlineProductById(Integer productId) {
        return discountProductManager.getOnlineById(productId);
    }

    @Override
    public Pagination<DiscountProductWithBLOBs> queryProductByOnline(QueryOnlineDiscountProductDTO query, Page page) {
        return discountProductManager.queryByOnline(query, page);
    }

    @Override
    public List<DiscountProductWithBLOBs> queryProductByOnline(QueryOnlineDiscountProductDTO query, Integer size) {
        return discountProductManager.queryByOnline(query, size);
    }

    @Override
    public DiscountProductWithBLOBs createProduct(AddDiscountProductDTO add, String createUser) {
        return discountProductManager.create(add, createUser);
    }

    @Override
    public void updateProduct(Integer productId, EditDiscountProductDTO edit, String updateUser) {
        discountProductManager.update(productId, edit, updateUser);
    }
    
    @Autowired
    private DiscountProductAttachManager discountProductAttachManager;
    
    @Override
	public void updateProductAttach(Integer productId, List<EditDiscountProductAttachDTO> attachList, String updateUser) throws BizException {
    	discountProductAttachManager.updateProductAttach(productId, attachList, updateUser);
	}
    
    @Override
	public List<DiscountProductAttach> listByMainProductId(Integer productId) {
		return discountProductAttachManager.listByMainProductId(productId);
	}

    @Override
    public void updateProductMarketing(Integer productId, EditDiscountProductOperationStrategyDTO edit, String updateUser) {
        discountProductManager.updateMarketing(productId, edit, updateUser);
    }

    @Override
    public void onlineProduct(Integer productId, String updateUser) {
        discountProductManager.online(productId, updateUser);
    }

    @Override
    public void offlineProduct(Integer productId, String updateUser) {
        discountProductManager.offline(productId, updateUser);
    }

    @Override
    public void deleteProduct(Integer productId, String updateUser) {
        discountProductManager.delete(productId, updateUser);
    }

    @Autowired
    private DiscountProductGiftCardManager discountProductGiftCardManager;

    @Override
    public void updateProductGiftCard(Integer productId, EditDiscountProductGiftCardDTO edit, String updateUser) {
        discountProductGiftCardManager.update(productId, edit, updateUser);
    }

    @Override
    public DiscountProductGiftCard getGiftCardByProductId(Integer productId) {
        return discountProductGiftCardManager.getByProductId(productId);
    }

    @Autowired
    private DiscountProductVouchersManager discountProductVouchersManager;

    @Override
    public void updateProductVouchers(Integer productId, EditDiscountProductVouchersDTO edit, String updateUser) {
        discountProductVouchersManager.update(productId, edit, updateUser);
    }

    @Override
    public DiscountProductVouchers getVouchersByProductId(Integer productId) {
        return discountProductVouchersManager.getByProductId(productId);
    }

    @Autowired
    private DiscountProductRechargeManager discountProductRechargeManager;

    @Override
    public void updateProductRecharge(Integer productId, EditDiscountProductRechargeDTO edit, String updateUser) {
        discountProductRechargeManager.update(productId, edit, updateUser);
    }

    @Override
    public DiscountProductRecharge getRechargeByProductId(Integer productId) {
        return discountProductRechargeManager.getByProductId(productId);
    }

    @Autowired
    private YouWorldGiftCardManager youWorldGiftCardManager;

    @Override
	public YouWorldGiftCard getYouWorldGiftCard(Integer cardId) {
		return youWorldGiftCardManager.getByCardId(cardId);
	}
    
    @Override
    public Pagination<YouWorldGiftCard> queryYouWorldGiftCard(String cardName,Sorting[] sorts, Page page) {
        return youWorldGiftCardManager.query(cardName,sorts, page);
    }

    @Autowired
    private YouWorldGiftCardOrderManager youWorldGiftCardOrderManager;

    @Override
    public Pagination<YouWorldGiftCardOrder> queryYouWorldGiftCardOrder(QueryYouWorldGiftCardOrderDTO query, Sorting[] sorts, Page page) {
        return youWorldGiftCardOrderManager.query(query, sorts, page);
    }

    @Autowired
    private YouWorldService youWorldService;

    @Override
    public YouWorldServiceProviderInfoDTO getYouWorldServiceProviderInfo() {
        return youWorldService.getServiceProviderInfo();
    }

    @Autowired
    private QuanMaoCardManager quanMaoCardManager;

    @Override
    public Pagination<QuanMaoCard> queryQuanMaoCard(Sorting[] sorts, Page page) {
        return quanMaoCardManager.query(sorts, page);
    }

    @Autowired
    private QuanMaoCardOrderManager quanMaoCardOrderManager;

    @Override
    public Pagination<QuanMaoCardOrder> queryQuanMaoCardOrder(QueryQuanMaoCardOrderDTO query, Sorting[] sorts, Page page) {
        return quanMaoCardOrderManager.query(query, sorts, page);
    }

    @Autowired
    private QuanMaoService quanMaoService;

    @Override
    public QuanMaoServiceProviderInfoDTO getQuanMaoServiceProviderInfo() {
        return quanMaoService.getServiceProviderInfo();
    }

    @Autowired
    private DiscountProductInventoryManager discountProductInventoryManager;

    @Override
    public DiscountProductInventory addInventory(Integer productId, AddDiscountProductInventoryDTO add, String createUser) {
        return discountProductInventoryManager.add(productId, add, createUser);
    }

    @Override
    public void batchAddInventory(Integer productId, List<AddDiscountProductInventoryDTO> addList, String createUser) {
        discountProductInventoryManager.batchAdd(productId, addList, createUser);
    }

    @Override
    public void updateInventory(Integer inventoryId, EditDiscountProductInventoryDTO edit, String updateUser) {
        discountProductInventoryManager.update(inventoryId, edit, updateUser);
    }

    @Override
    public DiscountProductInventory getInventoryById(Integer inventoryId) {
        return discountProductInventoryManager.getById(inventoryId);
    }

    @Override
    public Pagination<DiscountProductInventory> queryInventory(QueryDiscountProductInventoryDTO query, Sorting[] sorts, Page page) {
        return discountProductInventoryManager.query(query, sorts, page);
    }

    @Override
    public void invalidInventory(Integer inventoryId, String updateUser) {
        discountProductInventoryManager.invalid(inventoryId, updateUser);
    }

    @Override
    public void deleteInventory(Integer inventoryId, String updateUser) {
        discountProductInventoryManager.delete(inventoryId, updateUser);
    }

	@Override
	public Long productInventory(Integer productId) {
		return discountProductInventoryManager.productInventory(productId);
	}
}
